﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace NewsPortal.DataAccess.Abstraction
{
    public interface IRepository<T> where T:class, IEntity
    {
        void Add(T item);
        void Remove(T item);
        void Update(T item);
        void Attach(T item);
        IQueryable<T> All();
        T First(string[] includes);
        Task<T> FirstAsync(string[] includes);
        T First(Func<T, bool> predicate, string[] includes);
        T FirstOrDefault(Func<T, bool> predicate, string[] includes);
        Task<T> FirstAsync(Expression<Func<T, bool>> predicate, string[] includes);  
        IQueryable<T> Where(Func<T, bool> predicate, string[] includes);
        bool Any(Func<T, bool> predicate);
        Task<bool> AnyAsync(Expression<Func<T, bool>> predicate);        
    }
}
